package com.flymobi.mshop.adapter;

import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.flymobi.mshop.R;

public class ClassessAdapter extends BaseAdapter {
	Context mContext;
	int positionTemp;
	private String[] mainString = { "图书", "音乐", "家用电器", "手机数码", "电脑办公", "家具家装",
			"服饰鞋帽", "个护化妆", "礼品箱包" };

	public ClassessAdapter(Context context) {
		this.mContext = context;
	}

	@Override
	public int getCount() {
		return mainString.length;
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return mainString[position];
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder;
		holder = new ViewHolder();
		convertView = LayoutInflater.from(mContext).inflate(
				R.layout.classes_item, null);
		holder.classes_name = (TextView) convertView
				.findViewById(R.id.classess_name);
		holder.list_idex = (ImageView) convertView.findViewById(R.id.list_idex);
		if (position % 2 == 0) {
			// convertView.setBackgroundColor(0xaafefefe);#f6f5ec
			convertView.setBackgroundColor(Color.WHITE);
		}
		holder.classes_name.setText(mainString[position]);

		return convertView;
	}

	class ViewHolder {
		ImageView list_idex;
		TextView classes_name;
	}
}
